/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.inventory.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.StoreProduct;

/**
 * 库存盘点明细Entity
 * @author lvbo
 * @version 2013-11-18
 */
@Entity
@Table(name = "store_inventory_check_detail")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class StoreInventoryCheckDetail extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private StoreInventoryCheck storeInventoryCheck; 	// 库存盘点
	private StoreProduct storeProduct; // 产品
	private String spec; // 规格
	private float retailPrice; // 实际价格
	private int beforeAdjustAmount; // 调整前产品库存数量
	private int afterAdjustAmount; // 调整后产品库存数量
	private float lossMoney; // 损失金额{[LOSS_MONEY]=([BEFORE_ADJUST_AMOUNT] - [AFTER_ADJUST_AMOUNT])*[RETAIL_PRICE]}
	private String remark; //备注

	public StoreInventoryCheckDetail() {
	}

	public StoreInventoryCheckDetail(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_inventory_storeInventoryCheckDetail")
	//@SequenceGenerator(name = "seq_inventory_storeInventoryCheckDetail", sequenceName = "seq_inventory_storeInventoryCheckDetail")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="SIC_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public StoreInventoryCheck getStoreInventoryCheck() {
		return storeInventoryCheck;
	}

	public void setStoreInventoryCheck(StoreInventoryCheck storeInventoryCheck) {
		this.storeInventoryCheck = storeInventoryCheck;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="PRODUCT_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public StoreProduct getStoreProduct() {
		return storeProduct;
	}

	public void setStoreProduct(StoreProduct storeProduct) {
		this.storeProduct = storeProduct;
	}

	public String getSpec() {
		return spec;
	}

	public void setSpec(String spec) {
		this.spec = spec;
	}

	@Column(name="retail_price")
	public float getRetailPrice() {
		return retailPrice;
	}

	public void setRetailPrice(float retailPrice) {
		this.retailPrice = retailPrice;
	}

	@Column(name="before_adjust_amount")
	public int getBeforeAdjustAmount() {
		return beforeAdjustAmount;
	}

	public void setBeforeAdjustAmount(int beforeAdjustAmount) {
		this.beforeAdjustAmount = beforeAdjustAmount;
	}

	@Column(name="after_adjust_amount")
	public int getAfterAdjustAmount() {
		return afterAdjustAmount;
	}

	public void setAfterAdjustAmount(int afterAdjustAmount) {
		this.afterAdjustAmount = afterAdjustAmount;
	}

	@Column(name="loss_money")
	public float getLossMoney() {
		return lossMoney;
	}

	public void setLossMoney(float lossMoney) {
		this.lossMoney = lossMoney;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}


